package com.jqq.codeblock_;

public class CodeBlockDetail {
    public static void main(String[] args) {
        Son son = new Son();
    }
}
class Father{
    private static int n1 = getVal01();
    public int n2 = getVal02();
    static {
        System.out.println("father的一个静态代码块");
    }
    {
        System.out.println("father的一个普通代码块");
    }

    public static int getVal01() {
        System.out.println("getVal01");
        return 10;
    }
    public int getVal02() {
        System.out.println("getVal02");
        return 20;
    }
    public Father() {
        System.out.println("father的构造器");
    }
}
class Son extends Father{
    private static int n3 = getVal03();
    public int n4 = getVal04();
    static {
        System.out.println("son的静态代码块");
    }
    {
        System.out.println("son的普通代码块");
    }
    public static int getVal03() {
        System.out.println("getVal03");
        return 30;
    }
    public int getVal04() {
        System.out.println("getVal04");
        return 40;
    }

    public Son() {
        System.out.println("son的构造器");
    }
}